//package org.jeecg.modules.deepseek.neo4j.service;
//
//import org.jeecg.modules.deepseek.neo4j.dto.EventRepository;
//import org.jeecg.modules.deepseek.neo4j.vo.Event;
//import org.springframework.data.neo4j.core.Neo4jClient;
//import org.springframework.stereotype.Service;
//import org.springframework.beans.factory.annotation.Autowired;
//
//import java.util.ArrayList;
//import java.util.Collection;
//import java.util.List;
//import java.util.Map;
//
//@Service
//public class EventService {
//
//    @Autowired
//    private Neo4jClient neo4jClient;
//
//    // 根据类别查询事件
//    public List<Map<String, Object>> getEventsByCategory(String categoryName) {
//        String cypherQuery = "MATCH (e:Event)-[:BELONGS_TO]->(c:Category {name: $categoryName}) RETURN e";
//        Collection<Map<String, Object>> results = neo4jClient.query(cypherQuery)
//                .bind(categoryName).to("categoryName")
//                .fetch()
//                .all();
//        return new ArrayList<>(results);
//    }
//
//    // 根据关键词查询
//    public List<Map<String, Object>> getEventsByKeyword(String keyword) {
//        String cypherQuery = "MATCH (e:Event) WHERE e.title CONTAINS $keyword RETURN e";
//        Collection<Map<String, Object>> results = neo4jClient.query(cypherQuery)
//                .bind(keyword).to("keyword")
//                .fetch()
//                .all();
//        return new ArrayList<>(results);
//    }
//
//    // 根据字段插入新事件
//    public void createEvent(String title, String timestamp, String categoryName) {
//        String cypherQuery = "MERGE (c:Category {name: $categoryName}) " +
//                "CREATE (e:Event {title: $title, timestamp: $timestamp}) " +
//                "MERGE (e)-[:BELONGS_TO]->(c)";
//
//        neo4jClient.query(cypherQuery)
//                .bind(title).to("title")
//                .bind(timestamp).to("timestamp")
//                .bind(categoryName).to("categoryName")
//                .run();
//    }
//
//    // 更新事件标题
//    public void updateEventTitleById(Long eventId, String newTitle) {
//        String cypherQuery = "MATCH (e:Event) WHERE e.id = $eventId " +
//                "SET e.title = $newTitle";
//
//        neo4jClient.query(cypherQuery)
//                .bind(eventId).to("eventId")
//                .bind(newTitle).to("newTitle")
//                .run();
//    }
//}
//
